package com.wc.alorithm_blue_bridge._思维.Q1463;

/**
 * @Author congege
 * @Description 货物摆放
 * https://www.lanqiao.cn/problems/1463/learning/?page=1&first_category_id=1&sort=students_count&second_category_id=3
 * @Date Created in 2023/9/18-18:17
 */
public class Main2 {
    public static void main(String[] args) {
        long n = 2021041820210418L;

        long mid = (long) Math.pow(n, 1.0 / 3) + 1;

        long ans = 0L;
        /**
         * 考虑到大小顺序的话就好找了
         *
         * 假设 第一个数 x
         *     第二个数 y
         *     第三个数 z
         *     使得 x <= y <= z
         *     说明 x <= n ^ (1/3)
         *         y <= (n / x) ^ (1 / 2)
         *
         * 答案计算，排列组合
         * 当 x < y < z 满足时有6种排列组合分别是   xyz xzy yxz yzx zxy zyx
         * 当 x = y < z 满足时有3中排列组合分别是   zxx xzx xxz
         * 当 x < y = z 满足时有3中排列组合分别是   xyy yxy yyx
         * 当 x = y = z 满足是就只有1中           xxx
         * 所以具体代码如下
         */

        for (long i = 1L; i <= mid; i++) {
            if (n % i == 0) {
                long leave = n / i;
                long secMid = (long) Math.sqrt(leave) + 1L;

                for (long j = i; j <= secMid; j++) {
                    if (leave % j == 0) {
                        long last = leave / j;
                        if (i == j && j == last) {
                            ans++;
                        } else if(i == j || j == last) {
                            ans += 3;
                        } else{
                            ans+=6;
                        }
                    }
                }
            }
        }
        System.out.println(ans);
    }
}
